/* 
工具函数
 */

// 验证账号&密码
export const isAccount=(value)=>{
    return /^[a-zA-Z0-9]{3,12}$/.test(value)
}


export const padZero=(n)=>{
    return n<10?'0'+n:n
}

// 转换时间格式
export const normalizeDate = (time, s = '-') => {
    let date = new Date(time)

    let y = date.getFullYear()
    let m = date.getMonth() + 1;
    let d = date.getDate()

    return [y, m, d].map(v => padZero(v)).join(s)
}

// 转换时间格式
export const normalizedate = (time, s = '-') => {
    let date = new Date(time)

    let y = date.getFullYear()
    let m = date.getMonth() + 1;
    let d = date.getDate()
       // 时
       let h=date.getHours()

       // 分
       let mi=date.getMinutes()

       // 秒
       let si=date.getSeconds()

    return [y, m, d,h,mi,si].map(v => padZero(v)).join(s)
}